package com.ajieee.merge.mapper;

import com.ajieee.merge.entity.finance.po.TradeDatePO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

/**
 * @author ajieee
 * @date 2025-10-26
 */
public interface TradeDateMapper extends BaseMapper<TradeDatePO> {

	default LocalDate getTradeDate() {
		return getTradeDate(LocalDate.now());
	}

	@Select("""
			select max(trade_date)
			from t_fin_trade_date
			where trade_date <= #{base}
			""")
	LocalDate getTradeDate(LocalDate base);

}
